﻿// -------------------------------------------------------------------------
//    @FileName         :    NFWorldWelfareService.cpp
//    @Author           :    gaoyi
//    @Date             :    2025-07-09
//    @Email			:    445267987@qq.com
//    @Module           :    NFWorldWelfareService
//
// -------------------------------------------------------------------------

#include "NFWorldWelfareService.h"

#include "NFComm/NFPluginModule/NFCheck.h"
#include "NFComm/NFPluginModule/NFIConfigModule.h"

int NFWorldWelfareService::GetServerOpenTime(uint32_t& dwGameOpenUnixSec)
{
    auto pConfig = FindModule<NFIConfigModule>()->GetAppConfig(NF_ST_WORLD_SERVER);
    CHECK_NULL(0, pConfig);

    dwGameOpenUnixSec = pConfig->GetServerOpenTime();
    return 0;
}

int NFWorldWelfareService::CheckInUnixTimeRange(const UnixTimeRange& timeRange, uint32_t dwUnixSec)
{
    if (dwUnixSec < timeRange.m_stUnixTimeOneBegin.m_szTime_t)
    {
        return 1;
    }
    if (dwUnixSec > timeRange.m_stUnixTimeOneEnd.m_szTime_t)
    {
        return 2;
    }
    return 0;
}

bool NFWorldWelfareService::IsHaveWorldData(const E_Welfare& stDesc)
{
    switch (stDesc.m_type)
    {
        case WELFARE_TYPE_WORLD_COLLECT:
        case WELFARE_TYPE_WORLD_VOTE_COLLECT:
        {
            return true;
        }
    }
    return false;
}
